<?php

$params = array_merge(
        require(__DIR__ . '/../../common/config/params.php'),
		require(__DIR__ . '/params.php')
);

return [
    'id' => 'app',
    'name' => '折宝宝',
    'basePath' => dirname(__DIR__),
    'bootstrap' => ['log'],
    'controllerNamespace' => 'app\controllers',
    'components' => [
        'request' => [
            // !!! insert a secret key in the following (if it is empty) - this is required by cookie validation
            'cookieValidationKey' => 'a3425nbdsarathw45',
            'enableCsrfCookie' => false
        ],
        'log' => [
            'traceLevel' => YII_DEBUG ? 3 : 0,
            'targets' => [
                [
                    'class' => 'yii\log\FileTarget',
                    'levels' => ['error', 'warning'],
                ],
            ],
        ],
        'errorHandler' => [
            'errorAction' => 'site/error',
        ],
        'urlManager' => [
            'enablePrettyUrl' => true,
            'showScriptName'  => false,
            'enableStrictParsing' => false,
            'rules'           => [
                'post'          => 'blog/post/index',
                'post/'         => 'blog/post/',
                'post/<id:\d+>' => 'blog/post/view',
                'page/<id:\d+>' => 'blog/page/view',
                'gallery/'      => 'blog/gallery',
            ],
        ],
        'view' => [
            'theme' => [
                'pathMap' => [
                    '@dektrium/user/views' => '@app/views/user'
                ],
            ],
        ],
        'user' => [
//            'returnUrl' => '/dashboard'
        ],
        'as access' => [
            'class' => 'mdm\admin\components\AccessControl',
            'allowActions' => [
                'dashboard/*',
            ]
        ],
    ],
    'modules' => require(__DIR__ . '/modules.php'),
    'params' => $params,
];
